﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="caky.aspx.cs" Inherits="EZCRS.HCMS.Web.manage.booklog.caky" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
   <title></title>

   <script src="../../Common/base_grid.js" language="javascript" type="text/javascript"></script>  
   
   
   
   <script src="../../common/calendar1.js" language="javascript" type="text/javascript"></script>
<style type="text/css">
.bkline,.ciline{overflow:hidden;text-align:right;}
.bkline{background-image:url(../../image/countbg.gif);height:11px;}
.ciline{background-image:url(../../image/onlybg.gif);height:8px;}
#main-report img{background-color:#fff}
.citxt{color:#FD9F02}
</style>
</head>
<body>
    <form id="form1" runat="server">
        <uc2:titlepage id="Titlepage1" runat="server" inittitle="<%$ Resources:Site, CakyTitle %>"></uc2:titlepage>
        
        <table class="main-table"  cellpadding="1" cellspacing="1">
            <tr class="line-even">
                <td style="width:10%; text-align: right;">
                    <asp:Label ID="Label1" runat="server" Text="<%$ Resources:Site, SelectDate %>"></asp:Label>：</td>
                <td width="20%" style="text-align: left;">
                    &nbsp;
                    <input id="cdate" runat="server" class="text-line"  style="width: 100px"
                        type="text" value="yyyy-MM-dd" /> </td>
                <td style="width:10%; text-align: right;">
                    <asp:Label ID="Label2" runat="server" Text="<%$ Resources:Site, DateType %>"></asp:Label>：</td>
                <td width="20%" style="text-align: left;">
                    <asp:RadioButtonList ID="rbl" runat="server" RepeatDirection="Horizontal">
                    </asp:RadioButtonList></td>
                    
                <td>
                <asp:Button  ID="BtnSearch"  runat="server" CssClass="bttn" OnClientClick="javascript:search();return false;" Text="<%$ Resources:Site, ButtonSearch %>"  /></td>
            <td>
                        <asp:DropDownList ID="rblsort" runat="server" Visible="False">
                        </asp:DropDownList></td></tr>
            
            
        </table>
    </form>
  <br />
  <table class="main-table"  cellpadding="1" cellspacing="1">
  <tr class="line-odd">
   <td>
       <div id="alltotal"></div></td>
  </tr>
  <tr class="line-even">
   <td>
   <div id="datas"></div>
   </td>
  </tr>
  <tr><td><table cellpadding="1" cellspacing="1" width="100%">
             <tr><td width="30%"></td><td style="width:100px;"><div class="bkline" style="width:100px;"><img src="../../image/count.gif"  style="background-color:#fff" /></div></td><td style="width:50px;">
                 <asp:Label ID="Label3" runat="server" Text="<%$ Resources:Site, BookTotal %>"></asp:Label></td><td style="width:100px;"><div class="ciline" style="width:100px;"><img src="../../image/only.gif" style="background-color:#fff" /></div></td><td>
                 <asp:Label ID="Label4" runat="server" Text="<%$ Resources:Site, CheckInTotal %>"></asp:Label></td><td></td></tr>
           </table></td></tr>
  <tr><td style="text-align:center;height:25px;"><div id="navdatas"></div></td></tr>
  </table>
<script language="javascript" type="text/javascript">
var totaltable;
var totalpage;

function search()
{
 var strcdate=$F("cdate");
 var strrbl=document.getElementsByName("rbl");
 var strrbls="";
 for(i=1;i<strrbl.length;i++)
  if(strrbl[i].checked)
     strrbls=strrbl[i].value;
 //var strrblsort=$F("rblsort");

    EZCRS.HCMS.myajax.CardUserLog.BookReport(strcdate.value,strrbls,"",binddata);

}

function binddata(resp)
{
 totaltable=resp.value;
 if(totaltable.Tables[0].Rows.length==0)
 {
  $F("datas").innerHTML="<font color=red><%= Resources.Site.AlertErrorMsg %></font>";
  $F("alltotal").innerHTML="";
  return;
 }
 $F("alltotal").innerHTML=" <%= Resources.Site.caky_no1 %> <a href=\"bookrecord.aspx\" title=\"<%= Resources.Site.caky_no2 %>\">"+totaltable.Tables[1].Rows[0]["booktotal"]+"</a> <%= Resources.Site.caky_no3 %> <a href=\"orderstatus.aspx\" title=\"<%= Resources.Site.caky_no4 %>\">"+((totaltable.Tables[1].Rows[0]["intotal"]==null)?0:totaltable.Tables[1].Rows[0]["intotal"])+"</a> <%= Resources.Site.caky_no5 %> "+((totaltable.Tables[1].Rows[0]["booknights"]==null)?0:totaltable.Tables[1].Rows[0]["booknights"])+" <%= Resources.Site.caky_no6 %> "+((totaltable.Tables[1].Rows[0]["innights"]==null)?0:totaltable.Tables[1].Rows[0]["innights"])+" <%= Resources.Site.caky_no7 %>";
 if(totaltable.Tables[0].Rows.length % 50==0)
  totalpage=totaltable.Tables[0].Rows.length/50;
 else
  totalpage=parseInt(totaltable.Tables[0].Rows.length/50) +1;
 initpagenav(1);
 initpage(1);}
 
 
 
 
function initpage(cpage)
{
 linewidth=totaltable.Tables[0].Rows[0]["booktotal"];
 piewidth=500/linewidth;
 
 var str="<table id=\"main-report\" cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">";
 str+="<tr class=\"line-odd\" style=\"text-align:center\"><td width=\"20%\"><%= Resources.Site.caky_no8 %></td><td><%= Resources.Site.booking %>(<span class=\"citxt\" style=\"width:90px;\"><%= Resources.Site.checkin %></span>)<%= Resources.Site.time %></td><td><%= Resources.Site.booking %>(<span class=\"citxt\" style=\"width:90px;\"><%= Resources.Site.checkin %></span>)<%= Resources.Site.roomnight %></td><td></td></tr>";
 var sstep=(cpage-1)*50+1;
 var estep=sstep+49;
 for(i=sstep;i<=estep;i++)
 {
  if(totaltable.Tables[0].Rows[i-1]==null)
   break;
   
  intotal=0;
  if(totaltable.Tables[0].Rows[i-1]["intotal"]!=null)
    intotal=totaltable.Tables[0].Rows[i-1]["intotal"];
  booktotal=0;
  if(totaltable.Tables[0].Rows[i-1]["booktotal"]!=null)
    booktotal=totaltable.Tables[0].Rows[i-1]["booktotal"];
  booknights=0;
  if(totaltable.Tables[0].Rows[i-1]["booknights"]!=null)
    booknights=totaltable.Tables[0].Rows[i-1]["booknights"];
  innights=0;
  if(totaltable.Tables[0].Rows[i-1]["innights"]!=null)
    innights=totaltable.Tables[0].Rows[i-1]["innights"];
  str+="<tr><td>"+totaltable.Tables[0].Rows[i-1]["booktitle"]+"</td><td align=center>"+booktotal+"(<span class=\"citxt\">"+intotal+"</span>)</td><td align=center>"+booknights+"(<span class=\"citxt\">"+innights+"</span>)</td><td><div class=\"bkline\" style=\"width:"+(piewidth*booktotal+10)+"px;\"><img src=\"../../image/count.gif\" /></div><div class=\"ciline\" style=\"width:"+(piewidth*intotal+10)+"px;\"><img src=\"../../image/only.gif\" /></div></td></tr>";
 }
 str+="</table>";
 $F("datas").innerHTML=str;
}

function initpagenav(cpage)
{
 if(totalpage<=1)
    return;
  var navstr="";
  for(i=1;i<=totalpage;i++)
  {
    if(i==cpage)
      navstr+=" | " + cpage;
      else
      navstr+=" | <a href=\"javascript:gopage("+i+");\">"+i+"</a>";
  }
  if(navstr!="")
   navstr+=" |";
  $F("navdatas").innerHTML=navstr;
}

function gopage(i)
{initpagenav(i);initpage(i);}


</script>
</body>
</html>





